package com.lianxi.util;

import com.lianxi.pojo.User;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.util.TextUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author fy
 * 字符串处理
 */
public class StringUtil extends StringUtils {
    //截取两个字符串之间的内容
    public static String getCutOutString(String str, String start, String endwith) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        String result = "";
        if (str.contains(start)) {
            String s1 = str.split(start)[1];
            if (endwith == null || "".equals(endwith)) {
                result = s1;
            } else {
                String s2[] = s1.split(endwith);
                if (s2 != null) {
                    result = s2[0];
                }
            }
        }
        return result;
    }


    public static void main(String[] args) {
        ArrayList<User> list = new ArrayList<>();
        list.add(new User(1,"齐浩",18));
        list.add(new User(1,"齐浩",18));


        String join = StringUtils.join("", list);
        System.out.println(join);


        String format = String.format("不支持该类型（%s）", 200);
        System.out.println(format);
    }
}
